import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../AppConfig/Config.dart';
import '../../l10n/messages.dart';

class Invoicing extends StatefulWidget {
  const Invoicing({super.key});

  @override
  State<Invoicing> createState() => _InvoicingState();
}

class _InvoicingState extends State<Invoicing> {
  List moneyList=["300.00","200.00"];
  List chooseList=[];
  @override
  Widget build(BuildContext context) {
    var messages = AppLocalizations.of(context)!;
    final screenSize = MediaQuery.of(context).size;
    return Scaffold(
      backgroundColor: MyColors.backgreyColor,
      appBar: AppBar(
        backgroundColor: Colors.white,
        centerTitle: true,
        title: Text("开票",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w300,fontSize: 16.sp),),
      ),
      body:   Column(
        children: [
        Expanded(child:Container(
      height: moneyList.length*108.h,
        child:  ListView.builder(
            itemCount: moneyList.length,
            itemBuilder: (BuildContext context, int index) {
              return   Container(
                margin: EdgeInsets.only(left: 10.w,right: 10.w,top: 8.h),
                padding: EdgeInsets.only(left: 8.w,right: 8.w,top: 10.h,bottom: 10.h),
                decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.all(Radius.circular(10),),
                ),
                child: Column(
                  children: [
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Row(
                          children: [
                            Text("苏州"+" "+"吴中",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600),),
                            SizedBox(width: 8.w,),
                            Icon(Icons.trending_flat,),
                            SizedBox(width: 8.w,),
                            Text("宁波"+" "+"北仑",style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600),),
                          ],
                        ),
                        Text("2023-03-27 10:20",style: TextStyle(color: MyColors.textColor,fontSize: 12.sp),),
                      ],
                    ),
                    SizedBox(height: 20.h,),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Row(
                          crossAxisAlignment: CrossAxisAlignment.end,
                          children: [
                            SizedBox(width: 40.w,),
                            Text("¥",style: TextStyle(color: MyColors.themeColor,),),
                            Text(moneyList[index],style: TextStyle(color: MyColors.themeColor,fontSize: 20.sp),),
                          ],
                        ),
                        IconButton(
                            onPressed: (){
                              setState(() {
                                chooseList.contains(index)?
                                chooseList.remove(index):chooseList.add(index);
                                print(chooseList);
                              });
                            },

                            icon:  chooseList.contains(index)?Icon(Icons.
                            check_circle,color: MyColors.themeColor,)
                                :Icon(Icons.panorama_fish_eye,color: MyColors.hintColor,)),


                      ],
                    ),
                  ],
                ),
              );
            }
        ),
      ),
        ),
          Container(
            height: 80.h,
            color: Colors.white,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Container(
                    height: 40.h ,
                    margin: EdgeInsets.only(left: 30.w,right: 30.w),
                    decoration: BoxDecoration(
                        color:Color.fromRGBO(231, 112, 27, 0.85),
                        borderRadius: BorderRadius.all(Radius.circular(30))),

                    width: double.infinity,


                    child: TextButton(
                      child: Text(messages["提交"],style: TextStyle(color: Colors.white,fontSize: 14.sp),),

                      onPressed: (){

                      },
                    )
                ),
              ],
            ),
          ),
        ],
      ),


    );
  }
}
